﻿<%@ Page Language="C#" MasterPageFile="~/Templates/Admin.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Admin_Poll_Default" Title="Untitled Page" %>
<%@ Register Src="~/Controls/wucEmptyGridMessage.ascx" TagName="EmptyGridMessage" TagPrefix="wuc" %>
<%@ Register Src="~/Controls/wucDatePicker.ascx" TagName="DatePicker" TagPrefix="wuc" %>
<%@ Register Assembly="Jalal.Library" Namespace="Jalal.Library.Web.Control" TagPrefix="ucc" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <script src="<%= siteRoot %>Javascripts/Common/ApplicationCommon.js" type="text/javascript"></script>
</asp:Content>
<asp:Content ID="MiddleAreaContent" ContentPlaceHolderID="MiddleArea" Runat="Server">
    <table>
        <tr>
            <td colspan="2">
                <ucc:ResponseMessage ID="uccResponse" runat="server"></ucc:ResponseMessage>
            </td>
        </tr>
        <tr>
            <td align="right">
                <asp:Button ID="btnDelete" runat="server" Text="Delete" OnClick="Delete_Click" />
            </td>
            <td>&nbsp;</td>
        </tr>
        <tr>
            <td>
                <asp:GridView ID="grvPollQuestions" runat="server" AutoGenerateColumns="false" OnRowDataBound="GridViewDataBound">
                    <Columns>
                        <asp:TemplateField>
                            <HeaderTemplate>
                                # 
                            </HeaderTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblId" runat="server" Text='<%# Eval("Id") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField>
                            <HeaderTemplate>
                                Question
                            </HeaderTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblQuestion" runat="server" Text='<%# Eval("Question") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField>
                            <HeaderTemplate>
                                Answers
                            </HeaderTemplate>
                            <ItemTemplate>
                                <asp:LinkButton ID="lkbAnswerCount" runat="server" Text='<%# Eval("AnswerCount") %>' 
                                    CommandName="ShowAnswers" CommandArgument='<%# Eval("Id") %>' OnCommand="ShowAnswerCommand"></asp:LinkButton>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField>
                            <HeaderTemplate>
                                Create Date
                            </HeaderTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblCreateDate" runat="server" Text='<%# Eval("CreateDateTime") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField>
                            <HeaderTemplate>
                                Activate
                            </HeaderTemplate>
                            <ItemTemplate>
                                <asp:RadioButton ID="rbtActivate" runat="server" GroupName="Activate" 
                                    Checked='<%# Eval("IsCurrentPollQuestion") %>' AutoPostBack="true" 
                                    OnCheckedChanged="Activate_Changed" />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField>
                            <HeaderTemplate>
                                <asp:CheckBox ID="cbxSelectAll" runat="server" />
                            </HeaderTemplate>
                            <ItemTemplate>
                                <asp:CheckBox ID="cbxSelect" runat="server" />
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                    <EmptyDataTemplate>
                        <wuc:EmptyGridMessage ID="EmptyGridMessage1" runat="server" MessageText="There is no poll question" />
                    </EmptyDataTemplate>
                </asp:GridView>
            </td>
            <td>
                <asp:GridView ID="grvPollAnswer" runat="server" AutoGenerateColumns="false" >
                    <Columns>
                        <asp:TemplateField>
                            <HeaderTemplate>
                                # 
                            </HeaderTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblId" runat="server" Text='<%# Eval("Id") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField>
                            <HeaderTemplate>
                                Answer
                            </HeaderTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblAnswer" runat="server" Text='<%# Eval("Answer") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField>
                            <HeaderTemplate>
                                Vote Count
                            </HeaderTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblVote" runat="server" Text='<%# Eval("Vote") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        </Columns>
                </asp:GridView>
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <asp:Panel ID="pnlPollEvent" runat="server" DefaultButton="btnCreateEvent" Visible="false">
                    <table>
                        <tr>
                            <td>
                                <asp:HiddenField ID="hdfId" runat="server" />
                                Start Date
                            </td>
                            <td>
                                <wuc:DatePicker ID="wucStartTime" runat="server" />
                            </td>
                            <td>
                                End Date
                            </td>
                            <td>
                                <wuc:DatePicker ID="wucEndTime" runat="server" />
                            </td>
                            <td>
                                <asp:Button ID="btnCreateEvent" runat="server" Text="Activate" OnClick="CreateEvent_Click" />
                            </td>
                        </tr>
                    </table>
                </asp:Panel>
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <table>
                    <tr>
                        <td>
                            Question                    
                        </td>
                        <td>
                            <asp:TextBox ID="tbxQuestion" runat="server" Width="400px"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>How many answer?</td>
                        <td>
                            <asp:DropDownList ID="ddlAnswerCount" runat="server" AutoPostBack="true" 
                                OnSelectedIndexChanged="AnswerCount_Changed">
                                <asp:ListItem Text="2" Value="2"></asp:ListItem>
                                <asp:ListItem Text="3" Value="3"></asp:ListItem>
                                <asp:ListItem Text="4" Value="4"></asp:ListItem>
                                <asp:ListItem Text="5" Value="5"></asp:ListItem>
                                <asp:ListItem Text="6" Value="6"></asp:ListItem>
                                <asp:ListItem Text="7" Value="7"></asp:ListItem>
                                <asp:ListItem Text="8" Value="8"></asp:ListItem>
                                <asp:ListItem Text="9" Value="9"></asp:ListItem>
                                <asp:ListItem Text="10" Value="10"></asp:ListItem>
                            </asp:DropDownList>
                        </td>
                    </tr>
                    <asp:Repeater ID="rptAnswerBoxes" runat="server">
                        <ItemTemplate>
                            <tr>
                                <td>Answer <%# Container.DataItem.ToString() %></td>
                                <td><asp:TextBox ID="tbxAnswer" runat="server" Width="400px"></asp:TextBox></td>
                            </tr>
                        </ItemTemplate>
                    </asp:Repeater>
                    <tr>
                        <td>&nbsp;</td>
                        <td>
                            <asp:Button ID="btnCreate" runat="server" Text="Create Poll Question" 
                            OnClick="Create_Click" />
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
</asp:Content>

